package T7;

import java.util.Arrays;

public class StringDemo7 {
    public static void main(String[] args) {
        // 声明并初始化String数组
        String[] fruits = {"pear", "banana", "apple", "watermelon", "melon", "orange"};
        // 使用Arrays.sort方法对数组进行排序
        Arrays.sort(fruits);
        // 遍历输出排序后的数组元素
        for (String fruit : fruits) {
            System.out.print(fruit + "\t");
        }
    }
}
